import Worker from "./Worker";
import { Moment } from 'moment';

export enum ClockInResult {
    NORMAL, BE_LATE, TOO_LATE, ABSENTEEISM_LATE
}

export enum ClockOutResult {
    NORMAL, EARLY, ABSENTEEISM_EARLY
}

export class ClockInInfo {
    clockInMoment: Moment | null;
    clockInResult: ClockInResult;
    constructor(clockInMoment: Moment | null, clockInResult: ClockInResult) {
        this.clockInMoment = clockInMoment;
        this.clockInResult = clockInResult;
    }
}

export class ClockOutInfo {
    clockOutMoment: Moment | null;
    clockOutResult: ClockOutResult;
    constructor(clockOutMoment: Moment | null, clockOutResult: ClockOutResult) {
        this.clockOutMoment = clockOutMoment;
        this.clockOutResult = clockOutResult;
    }
}

export class ClockInfo {
    clockInInfo: ClockInInfo;
    clockOutInfo: ClockOutInfo;
    constructor(clockInInfo: ClockInInfo, clockOutInfo: ClockOutInfo) {
        this.clockInInfo = clockInInfo;
        this.clockOutInfo = clockOutInfo;
    }
}

export default class AttendanceRecord {
    id: string;
    date: Moment;
    worker: Worker;
    origin: string;
    clockInfo: ClockInfo;
    clockMomentList: Moment[];
    constructor(attendanceRecord: AttendanceRecord) {
        this.id = attendanceRecord.id;
        this.date = attendanceRecord.date;
        this.worker = attendanceRecord.worker;
        this.origin = attendanceRecord.origin;
        this.clockInfo = attendanceRecord.clockInfo;
        this.clockMomentList = attendanceRecord.clockMomentList;
    }
}